<%

	var p = {
		id:id!"",
		name:name!"",
		value:value!"",
		isSubTag:(isSubTag!"true")=="true"?true:false // 是否是嵌套在自定义标签#form里面
	};
	
	var icon = isEmpty(value)?"fa fa-fw":value;
%>

<div class="input-group">
	<div class="input-group-prepend">
		<span class="input-group-text form-control-sm">
		  <i id="${p.id}Icon" class="${icon}"></i>
		</span>
	</div>
	<input id="${p.id}" name="${p.name}" type="text" value="${p.value}" class="form-control form-control-sm"/>
	<div class="input-group-append">
		<div class="input-group-text form-control-sm" id="${p.id}Button"><i class="fa fa-search"></i></div>
	</div>
</div>

<script type="text/javascript">
<% if(p.isSubTag) { %>
<![CDATA[
<%}%>
	$("#${id}Button").click(function(){
		js.layer.open({
		      type: 2,
		      title: '选择图标',
		      shadeClose: true,
		      scrollbar: false,
		      maxmin: true, //开启最大化最小化按钮
		      area: ['893px', '80%'],
		      content: ['${ctx}/tag/iconselect', 'auto'],
		      success: function(layero, index){
					var info = '<font color="red" class="float-left mt10">提示：双击选择图标。</font>';
					layero.find('.layui-layer-btn').append(info);
				},
		      btn: ['<i class="fa fa-times"></i> 关闭', '<i class="fa fa-eraser"></i> 清除'],
		      btn1: function(index, layero){
		    	  	var win = js.layer.iframeWindow(index);
					var icon = win.$("#icon").val();
					if(icon != null && icon != "" ) {
						$("#${id}Icon").attr("class", icon);
		                //$("#${id}IconLabel").text(icon);
		                $("#${id}").val(icon);
					}
					
					js.layer.close(index);
		    	  },
			  btn2: function(index, layero){
				  	$("#${id}Icon").attr("class", "");
	                //$("#${id}IconLabel").text("无");
	                $("#${id}").val("");
		    	  }
		    });
	});
<% if(p.isSubTag) { %>
	]]>
<%}%>
</script>
